package com.example.autocode.enums;

import lombok.Getter;

/**
 * @author zhangxin
 */
@Getter
public enum PartTypeEnum {
    PART_TYPE_1("1", "传入字符", 0),
    PART_TYPE_2("2", "当前日期时间", 1),
    PART_TYPE_3("3", "固定字符", 2),
    PART_TYPE_4("4", "流水号", 3),
    PART_TYPE_OTHER("other", "其他", 99);

    private final String code;

    private final String name;

    private final Integer beanIndex;

    PartTypeEnum(String code, String name, Integer beanIndex) {
        this.code = code;
        this.name = name;
        this.beanIndex = beanIndex;
    }
    public static PartTypeEnum getByCode(String code) {
        for (PartTypeEnum value : PartTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return PART_TYPE_OTHER;
    }
}
